# Author:sp
# CreaTime: $(DATE)
# FileName: $(NAME)
# Description: simple introdution of the code
class Student:
    def __init__(self,name,age):
        self.na=name
        self.ag=age
    def eat(self):
        print(self.na,'在吃饭')
'''一个Student类可以创建N多个Student类的实例对象，每个实例对象的属性值不同'''
stu1=Student('张三',20)
stu2=Student('李四',19)
print('-------为stu2动态绑定性别属性---------')
stu2.gender='女'
print(stu1.na,stu1.ag)
print(stu2.na,stu2.ag,stu2.gender)
print('--------为stu1单独绑定一个实例方法-----------')

def fun():
    print('定义在类之外的，称为函数')

stu1.fun=fun
stu1.fun()
#stu2.fun()          AttributeError: 'Student' object has no attribute 'fun'